<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>父子页面传值</title>
    <link rel="stylesheet" href="../../res/layui/css/layui.css">
    <script src="../../res/layui/layui.js"></script>
</head>
<body>

<div>
    <!--展示弹窗中设置的数据-->
    <div>
        子页面传输的值：<input id="valueHolderOnFather" readonly="readonly">
        <button id="showChildWindowBtn">弹出子页面</button>
    </div>


    <!--弹窗中的内容-->
    <div id="chileWindow" style="display: none">
        向父页面传输的值：<input id="valueHolderOnChild">
        <button id="sendValueBtn">发送数据</button>
    </div>
</div>

<script>

    layui.use(['layer', 'jquery'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;

        /**
         * 向父页面发送数据
         */
        $("#sendValueBtn").click(function () {
            $("#valueHolderOnFather").val(
                $("#valueHolderOnChild").val()
            );
        });

        /**
         * 点击事件：弹出子页面
         */
        $("#showChildWindowBtn").click(function () {
            console.log("显示Iframe")
            layer.open({
                type: 1,
                title: "子页面",
                area: ['700px', '450px'],
                fixed: false,
                maxmin: true,
                content: $("#chileWindow")
            });
        });
    });


</script>

</body>
</html>
